﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;

namespace TileEngine
{
    [Serializable]
    public class MapSquare
    {
        #region Fields
        //an array with the layer as the X value and the rotation of that layer as the Y value

        public LayerData[] m_layerData = new LayerData[TileMap.MapLayers];

        public string[] m_attributes = new string[3];//type, name....
        public bool m_blocked = false;
        public bool m_selected = false;
        //public Color m_color = Color.White;
        #endregion

        #region Constructor
        public MapSquare(LayerData[] a_layerData, string[] a_attributes, bool a_blocked, bool a_selected, Color a_color)
        {
            if (a_attributes != null)
                m_attributes = a_attributes;
            else
            {
                for (int i = 0; i < m_attributes.Length; i++)
                {
                    m_attributes[i] = "";
                }
            }

            if (a_layerData != null)
            {
                m_layerData = a_layerData;
            }
            else
            {
                for (int i = 0; i < m_layerData.Length; i++)
                {
                    m_layerData[i] = new LayerData();
                }
            }

            m_blocked = a_blocked;
            m_selected = a_selected;
            //m_color = a_color;
        }
        #endregion

        #region Public Methods
        public void ToggleBlocked()
        {
            m_blocked = !m_blocked;
        }

        public void ToggleSelected()
        {
            m_selected = !m_selected;
        }
        #endregion
    }
}
